﻿@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>西南石油工程公司车辆派遣管理系统</title>
    <script src="~/Scripts/jquery-1.10.2.min.js"></script>
    <script type="text/javascript">
        var todoCount = 0;
        var usecarCount = 0;
        var timerGetSendCars = self.setInterval("sendCars()", 3000)
        function sendCars() {
            $.post("/SendCar/GetMsgCount", null, function (data) {
                    var ent = eval(data);
                    window.frames["mainFrame"].frames["leftFrame"].document.getElementById("todocount").innerHTML = ent.TodoCount;
                    window.frames["mainFrame"].frames["leftFrame"].document.getElementById("carusercount").innerHTML = ent.UseCarCount;
                    if (ent.UseCarCount > usecarCount || ent.TodoCount > todoCount) {
                        //提示音播放
                        var myAuto = $("#audio")[0];
                        myAuto.play();

                        //内容提示
                        if(ent.UseCarCount > usecarCount){
                            $("#skipSendCar").show();
                        }else{
                            $("#skipSendCar").hide();
                        }
                        if(ent.TodoCount > todoCount){
                            $("#skipTodo").show();
                        }else{
                            $("#skipTodo").hide();
                        }

                        //消息框的弹出
                        var div_message = $("#div_message");
                        div_message.animate({ right: '10px' }, 500);

                        //消息关闭
                        var closeDiv = $("#close");
                        closeDiv.click(function () {
                            div_message.animate({ right: '-300px' }, 500);
                            myAuto.pause();
                        });

                        //处理点击新消息的跳转
                        var skipSendCar = $("#skipSendCar");
                        skipSendCar.click(function () {
                            myAuto.pause();
                            div_message.animate({ right: '-300px' }, 500);
                            $(window.frames["mainFrame"].document).find("#rightFrame").attr("src", "/SendCar/Index");
                        });
                        var skipTodo = $("#skipTodo");
                        skipTodo.click(function () {
                            myAuto.pause();
                            div_message.animate({ right: '-300px' }, 500);
                            $(window.frames["mainFrame"].document).find("#rightFrame").attr("src", "/UseCarApplication/Todo");
                        });
                    }
                    todoCount = ent.TodoCount;
                    usecarCount = ent.UseCarCount;
            },
            "json");
        }

        $(function () {
            $("#mainFrame").height(window.screen.height - 100);
        });
    </script>
    <style>
        body {
            margin: 0;
            padding: 0;
            overflow-x: hidden;
        }

        a {
            font-size: 12px;
            color: #666;
            text-decoration: none;
        }

        .div_message {
            border: 2px solid #D8E3F3;
            width: 260px;
            height: 66px;
            background: #f5d4d4;
            position: fixed;
            right: -262px;
            bottom: 10px;
        }

            .div_message .div_tsleft {
                width: 60px;
                height: 66px;
                display: block;
                float: left;
            }

            .div_message .div_tsright {
                width: 100px;
                height: 66px;
                padding-left: 20px;
                line-height: 30px;
                display: block;
                float: left;
            }

            .div_message .close {
                width: 30px;
                height: 22px;
                line-height: 22px;
                display: block;
                float: right;
            }
    </style>
</head>
<body>
    <iframe src="@Url.Action("Frame")" name="mainFrame" scrolling="No" noresize="noresize" id="mainFrame" title="mainFrame" style="width:100%;"></iframe>
    <div id="div_message" class="div_message">
        <div class="div_tsleft"><img src="~/Content/images/tishitubiao.png" /></div>
        <div class="div_tsright">
            <a id="skipSendCar" href="javascript:" style="display:none;">有新的派车记录！</a>
            <a id="skipTodo" href="javascript:" style="display:none;">有新的待办！</a>
        </div>
        <a id="close" href="javascript:" class="close">关闭</a>
    </div>
    <audio id="audio" src="~/Content/images/tishiyin.mp3" style="opacity:0" preload="auto" controls loop hidden="true" />
</body>

</html>
